<%@page import="conexao.Connect"%>

<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%
	boolean ok = false;	
	
	String Con_host = (String)request.getSession().getAttribute("Con_host");
	if (Con_host != null){
		String Con_database = (String) request.getSession().getAttribute("Con_database");
		String Con_usuario = (String) request.getSession().getAttribute("Con_usuario");
		String Con_senha = (String) request.getSession().getAttribute("Con_senha");
		
		Connect.updateConnection(Con_host,Con_database,Con_usuario,Con_senha);
		try{
			Connect.testConnection(request);
			ok = true;
		}catch(Exception ex){		
			//to-do
		}
	}	

	if (!ok){
		String host = config.getInitParameter("hostbd");
		String database = config.getInitParameter("databasebd");
		String usuariobd = config.getInitParameter("usuariobd");
		String senhabd = config.getInitParameter("senhabd");
		
		Connect.updateConnection(host,database,usuariobd,senhabd);
		try{
			Connect.testConnection(request);
		}catch(Exception ex){
			response.sendRedirect("login.jsp");
		}	
	}	

	String esquema = (String) session.getAttribute("esquema");
	if (esquema == null) {
		esquema = "azul";
	}
	
	String esquemacss = (String) session.getAttribute("esquemacss");
	if (esquemacss == null) {
		esquemacss = "azul_S";
	}
	
	
%>

<link href="css/<%=esquemacss%>.css" rel="stylesheet" type="text/css" />
<link REL="SHORTCUT ICON" HREF="images/esquema/<%=esquema%>/favicon.ico" type="image/x-icon" />
<link REL="ICON" HREF="images/esquema/<%=esquema%>/favicon.ico" type="image/x-icon" />



